Full source code website bán hàng thương mại điện tử gần giống shopee
468.922 lượt xem;
1 <?
2 if (isset($_REQUEST['act']))
3 {
4 ?><br>
5 <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 id="table35" style="line-height: 120%; text-align: justify">
6 <tr>
7 <td align="center" class="title" width="120"><font color="#FFF"><b>Hình ảnh</b></font></td>
8 <td align="center" class="title" width="500"><font color="#FFF"><b>Sản phẩm</b></font></td>
9 <td align="center" class="title" width="100">
10 <p align="left">
11 <font color="#FFF"><b>Chức năng</b></font></td>
12 </tr>
13 </table>
14 <TABLE cellSpacing=0 cellPadding=10 width="100%" border=0 id="table35" style="line-height: 120%; text-align: justify">
15 <?
16 if ($_REQUEST['cat_id']!='') $cat=killInjection($_REQUEST['cat_id']);
17 $catallsub=GetCatAllID($cat);
18 $where="1=1";
19 $keywords=killInjection($_REQUEST['keywords']);
20 if ($keywords!='')
21 {
22 $where.=" and (name like '%".$keywords."%' or content like '%".$keywords."%'";
23 $where.=") ";
24 }
25 if ($_REQUEST['cat_id']!='') $where.=" and cat in (".$catallsub."0)";
26 if ($_REQUEST['manufacturers_id']!='') $where.=" and providers_id=".$_REQUEST['manufacturers_id'];
27 if ($_REQUEST['pfrom']!='') $where.=" and price>=".$_REQUEST['pfrom'];
28 if ($_REQUEST['pto']!='') $where.=" and price_special<=".$_REQUEST['pto'];
29 if ($_REQUEST['dfrom']!='') $where.=" and products_date_added>=".$_REQUEST['dfrom'];
30 if ($_REQUEST['dto']!='') $where.=" and products_date_added<=".$_REQUEST['dto'];
31
32 $MAXPAGE=20;
33 $p=0;
34 if ($_REQUEST['p']!='') $p=$_REQUEST['p'];
35
36 $result = mysql_query("select count(*) from products where $where ",$con);
37 $total=mysql_fetch_row($result);
38
39 $sql="select * from products where $where limit ".$p*$MAXPAGE.",".$MAXPAGE;
40 $result = mysql_query($sql,$con);
41
42 while (($row=mysql_fetch_assoc($result)))
43 {
44 $danhmuc=mysql_query("select * from cat_mem where id='".$row['cat_mem']."'");
45 $xuat=mysql_fetch_assoc($danhmuc);
46 echo '<tr >';
47 echo '<td align="center" width="122"><IMG width="80" src="../'.$row['image'].'"></td><td align="left" width="572"><a id="xemnhanhsp" href="/index1.php?home=products&views='.$row["id"].'"><b><font color="#000000">'.$row['name'].'</font></b></a> <br> Shop: '.$row["user"].'<br> Giá: '.number_format($row["price_special"]).'đ</td><td align="center" width="99" ><a href="./?act=product_m&id='.$row['id'].'">Sửa</a> |
48 <a onclick="return confirm("Bạn có muốn xóa sản phẩm này không");" href="./?act=product&action=del&id='.$row['id'].'">Xoá</a></td>';
49 echo '</tr>';
50 }
51 settype($total[0],int);
52 ?>
53 </table>
54 <?
55 $s="act=search&act=search&keywords=$keywords&search_in_description=".$_REQUEST['search_in_description']."&categories_id=".$_REQUEST['categories_id']."&manufacturers_id=".$_REQUEST['manufacturers_id']."&pfrom=".$_REQUEST['pfrom']."&pto=".$_REQUEST['pto']."&dfrom=".$_REQUEST['dfrom']."&dto=".$REQUEST['dto'];
56 ?>
57
58 <form id="search1" name="search1" style="word-spacing: 0; margin: 0" method="GET" action="index.php?<? echo $s; ?>">
59 <input type="hidden" name="menu" value="<? echo $_REQUEST['menu']; ?>">
60 <input type="hidden" name="act" value="<? echo $_REQUEST['act']; ?>">
61 <input type="hidden" name="keywords" value="<? echo $_REQUEST['keywords']; ?>">
62 <input type="hidden" name="search_in_description" value="<? echo $_REQUEST['search_in_description']; ?>">
63 <input type="hidden" name="categories_id" value="<? echo $_REQUEST['categories_id']; ?>">
64 <input type="hidden" name="manufacturers_id" value="<? echo $_REQUEST['manufacturers_id']; ?>">
65 <input type="hidden" name="pfrom" value="<? echo $_REQUEST['pfrom']; ?>">
66 <input type="hidden" name="pto" value="<? echo $_REQUEST['pto']; ?>">
67 <input type="hidden" name="dfrom" value="<? echo $_REQUEST['dfrom']; ?>">
68 <input type="hidden" name="dto" value="<? echo $_REQUEST['dto']; ?>">
69 <input type="hidden" id="trang" name="p" value="1">
70 <TABLE cellSpacing=10 cellPadding=0 width="100%" border=0 id="table35" style="line-height: 120%; text-align: justify">
71 <?
72 $pages=count_page($total[0],$MAXPAGE);
73 echo '<tr><td colspan="2" align="center"><hr class="fieldkey" width="100%" SIZE=1></td></tr>';
74 echo '<tr><td class="smallfont" align="left">Trình bày <b>'.($p+1).'</b> đến <b>'.(int)($total[0]/$MAXPAGE+1).'</b> (trong <b>'.$total[0].'</b> sản phẩm)</td>';
75 echo '<td class="smallfont" align="right">Kết quả: ';
76 //$param="act=search&keywords=$keywords&search_in_description=".$_REQUEST['search_in_description']."&categories_id=".$_REQUEST['categories_id']."&manufacturers_id=".$_REQUEST['manufacturers_id']."&pfrom=".$_REQUEST['pfrom']."&pto=".$_REQUEST['pto']."&dfrom=".$_REQUEST['dfrom']."&dto=".$REQUEST['dto'];
77 if ($p>1) echo '<a title="Đầu tiên" href="#" onclick="javascript:changepage(0);return false;">[<]</a> ';
78 if ($p>0) echo '<a title="Về trước" href="#" onclick="javascript:changepage('.($p-1).');return false;">[<<]</a> ';
79 $from=($p-10>0?$p-10:0);
80 $to=($p+10<$pages?$p+10:$pages);
81 for ($i=$from;$i<$to;$i++)
82 {
83 //if ($i!=$p) echo '<a href="./?menu=search&'.$param.'&p='.$i.'">'.($i+1).' </a>';
84 if ($i!=$p) echo '<a href="#" onclick="javascript:changepage('.$i.');return false;">'.($i+1).' </a>';
85 else echo '<b>'.($i+1).'</b> ';
86 }
87 if ($p<$i-1) echo '<a title="Tiếp theo" href="#" onclick="javascript:changepage('.($p+1).');return false;">[>>]</a> ';
88 if ($p<$pages-1) echo '<a title="Cuối cùng" href="#" onclick="javascript:changepage('.($pages-1).');return false;">[>]</a> ';
89 echo '</td></tr></table>';
90 ?>
91 </form>
92
93 <script>
94 function changepage(num)
95 {
96 document.all.trang.value=num;
97 search1.submit();
98 }
99 </script>
100
101 <?
102 }
103 else
104 {
105 ?>
106 <TABLE border="0" cellpadding="10" cellspacing="1" width="100%" id="table1">
107 <TR><TD class="DialogBox">
108 <FORM name="searchform" action="./" method="GET">
109 <table cellSpacing="0" cellPadding="2" width="100%" border="0" id="table2">
110 <tr>
111 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Từ khóa:</span></font></td>
112 <td class="fieldValue" width="55%">
113 <span style="font-size: 8.5pt"><font size="1" face="Tahoma">
114 <input name="keywords" size="255" style="width: 200; height:22"></font></span></td>
115 </tr>
116 <tr>
117 <td width="35%" align="right"> </td>
118 <td class="fieldValue" width="55%">
119 <span style="font-size: 8.5pt"><font face="Tahoma">
120 <input type="checkbox" value="1" name="search_in_description"> Chỉ tìm
121 trong phần mô tả sản phẩm</font></span></td>
122 </tr>
123 <tr>
124 <td width="35%" align="right"> </td>
125 <td class="fieldValue" width="55%">
126 <font face="Verdana" size="1">
127 <span style="font-size: 8.5pt">
128 <font face="Tahoma">
129 <input type=submit value="Tìm kiếm" class=buttonorange onmouseover="this.className='buttonblue'" onmouseout="this.className='buttonorange'"></font></span></font></td>
130 </tr>
131 <tr>
132 <td width="35%" align="right"> </td>
133 <td class="fieldValue" width="55%"> </td>
134 </tr>
135 <tr>
136 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Trong danh mục:</span></font></td>
137 <td class="fieldValue" width="55%">
138 <span style="font-size: 8.5pt"><font face="Tahoma">
139 <select name="categories_id" size="1" style="width: 200">
140 <option selected value="">[Toàn bộ danh mục]</option>
141 <?
142 $cats=GetListCategory(17);
143 foreach ($cats as $cat)
144 {
145 echo '<option value="'.$cat[0].'">'.$cat[1].'</option>';
146 }
147 ?>
148 </select></font></span></td>
149 </tr>
150 <tr>
151 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Giá (>=):</span></font></td>
152 <td class="fieldValue" width="55%"><span style="font-size: 8.5pt">
153 <font face="Tahoma"><input name="pfrom"></font></span></td>
154 </tr>
155 <tr>
156 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Giá (<=):</span></font></td>
157 <td class="fieldValue" width="55%"><span style="font-size: 8.5pt">
158 <font face="Tahoma"><input name="pto"></font></span></td>
159 </tr>
160 <tr>
161 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Ngày (>=):</span></font></td>
162 <td class="fieldValue" width="55%">
163 <span style="font-size: 8.5pt"><font face="Tahoma">
164 <input name="dfrom"> (tháng/ngày/năm)</font></span></td>
165 </tr>
166 <tr>
167 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Ngày (<=):</span></font></td>
168 <td class="fieldValue" width="55%">
169 <span style="font-size: 8.5pt"><font face="Tahoma">
170 <input name="dto"> (tháng/ngày/năm)</font></span></td>
171 </tr>
172 </table>
173
174 <input type="hidden" name="act" value="search">
175
176 <input type="hidden" name="menu" value="search">
177
178 </FORM>
179 </TD></TR>
180 </TABLE>
181 <?
182 }
183 ?>
2 if (isset($_REQUEST['act']))
3 {
4 ?><br>
5 <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 id="table35" style="line-height: 120%; text-align: justify">
6 <tr>
7 <td align="center" class="title" width="120"><font color="#FFF"><b>Hình ảnh</b></font></td>
8 <td align="center" class="title" width="500"><font color="#FFF"><b>Sản phẩm</b></font></td>
9 <td align="center" class="title" width="100">
10 <p align="left">
11 <font color="#FFF"><b>Chức năng</b></font></td>
12 </tr>
13 </table>
14 <TABLE cellSpacing=0 cellPadding=10 width="100%" border=0 id="table35" style="line-height: 120%; text-align: justify">
15 <?
16 if ($_REQUEST['cat_id']!='') $cat=killInjection($_REQUEST['cat_id']);
17 $catallsub=GetCatAllID($cat);
18 $where="1=1";
19 $keywords=killInjection($_REQUEST['keywords']);
20 if ($keywords!='')
21 {
22 $where.=" and (name like '%".$keywords."%' or content like '%".$keywords."%'";
23 $where.=") ";
24 }
25 if ($_REQUEST['cat_id']!='') $where.=" and cat in (".$catallsub."0)";
26 if ($_REQUEST['manufacturers_id']!='') $where.=" and providers_id=".$_REQUEST['manufacturers_id'];
27 if ($_REQUEST['pfrom']!='') $where.=" and price>=".$_REQUEST['pfrom'];
28 if ($_REQUEST['pto']!='') $where.=" and price_special<=".$_REQUEST['pto'];
29 if ($_REQUEST['dfrom']!='') $where.=" and products_date_added>=".$_REQUEST['dfrom'];
30 if ($_REQUEST['dto']!='') $where.=" and products_date_added<=".$_REQUEST['dto'];
31
32 $MAXPAGE=20;
33 $p=0;
34 if ($_REQUEST['p']!='') $p=$_REQUEST['p'];
35
36 $result = mysql_query("select count(*) from products where $where ",$con);
37 $total=mysql_fetch_row($result);
38
39 $sql="select * from products where $where limit ".$p*$MAXPAGE.",".$MAXPAGE;
40 $result = mysql_query($sql,$con);
41
42 while (($row=mysql_fetch_assoc($result)))
43 {
44 $danhmuc=mysql_query("select * from cat_mem where id='".$row['cat_mem']."'");
45 $xuat=mysql_fetch_assoc($danhmuc);
46 echo '<tr >';
47 echo '<td align="center" width="122"><IMG width="80" src="../'.$row['image'].'"></td><td align="left" width="572"><a id="xemnhanhsp" href="/index1.php?home=products&views='.$row["id"].'"><b><font color="#000000">'.$row['name'].'</font></b></a> <br> Shop: '.$row["user"].'<br> Giá: '.number_format($row["price_special"]).'đ</td><td align="center" width="99" ><a href="./?act=product_m&id='.$row['id'].'">Sửa</a> |
48 <a onclick="return confirm("Bạn có muốn xóa sản phẩm này không");" href="./?act=product&action=del&id='.$row['id'].'">Xoá</a></td>';
49 echo '</tr>';
50 }
51 settype($total[0],int);
52 ?>
53 </table>
54 <?
55 $s="act=search&act=search&keywords=$keywords&search_in_description=".$_REQUEST['search_in_description']."&categories_id=".$_REQUEST['categories_id']."&manufacturers_id=".$_REQUEST['manufacturers_id']."&pfrom=".$_REQUEST['pfrom']."&pto=".$_REQUEST['pto']."&dfrom=".$_REQUEST['dfrom']."&dto=".$REQUEST['dto'];
56 ?>
57
58 <form id="search1" name="search1" style="word-spacing: 0; margin: 0" method="GET" action="index.php?<? echo $s; ?>">
59 <input type="hidden" name="menu" value="<? echo $_REQUEST['menu']; ?>">
60 <input type="hidden" name="act" value="<? echo $_REQUEST['act']; ?>">
61 <input type="hidden" name="keywords" value="<? echo $_REQUEST['keywords']; ?>">
62 <input type="hidden" name="search_in_description" value="<? echo $_REQUEST['search_in_description']; ?>">
63 <input type="hidden" name="categories_id" value="<? echo $_REQUEST['categories_id']; ?>">
64 <input type="hidden" name="manufacturers_id" value="<? echo $_REQUEST['manufacturers_id']; ?>">
65 <input type="hidden" name="pfrom" value="<? echo $_REQUEST['pfrom']; ?>">
66 <input type="hidden" name="pto" value="<? echo $_REQUEST['pto']; ?>">
67 <input type="hidden" name="dfrom" value="<? echo $_REQUEST['dfrom']; ?>">
68 <input type="hidden" name="dto" value="<? echo $_REQUEST['dto']; ?>">
69 <input type="hidden" id="trang" name="p" value="1">
70 <TABLE cellSpacing=10 cellPadding=0 width="100%" border=0 id="table35" style="line-height: 120%; text-align: justify">
71 <?
72 $pages=count_page($total[0],$MAXPAGE);
73 echo '<tr><td colspan="2" align="center"><hr class="fieldkey" width="100%" SIZE=1></td></tr>';
74 echo '<tr><td class="smallfont" align="left">Trình bày <b>'.($p+1).'</b> đến <b>'.(int)($total[0]/$MAXPAGE+1).'</b> (trong <b>'.$total[0].'</b> sản phẩm)</td>';
75 echo '<td class="smallfont" align="right">Kết quả: ';
76 //$param="act=search&keywords=$keywords&search_in_description=".$_REQUEST['search_in_description']."&categories_id=".$_REQUEST['categories_id']."&manufacturers_id=".$_REQUEST['manufacturers_id']."&pfrom=".$_REQUEST['pfrom']."&pto=".$_REQUEST['pto']."&dfrom=".$_REQUEST['dfrom']."&dto=".$REQUEST['dto'];
77 if ($p>1) echo '<a title="Đầu tiên" href="#" onclick="javascript:changepage(0);return false;">[<]</a> ';
78 if ($p>0) echo '<a title="Về trước" href="#" onclick="javascript:changepage('.($p-1).');return false;">[<<]</a> ';
79 $from=($p-10>0?$p-10:0);
80 $to=($p+10<$pages?$p+10:$pages);
81 for ($i=$from;$i<$to;$i++)
82 {
83 //if ($i!=$p) echo '<a href="./?menu=search&'.$param.'&p='.$i.'">'.($i+1).' </a>';
84 if ($i!=$p) echo '<a href="#" onclick="javascript:changepage('.$i.');return false;">'.($i+1).' </a>';
85 else echo '<b>'.($i+1).'</b> ';
86 }
87 if ($p<$i-1) echo '<a title="Tiếp theo" href="#" onclick="javascript:changepage('.($p+1).');return false;">[>>]</a> ';
88 if ($p<$pages-1) echo '<a title="Cuối cùng" href="#" onclick="javascript:changepage('.($pages-1).');return false;">[>]</a> ';
89 echo '</td></tr></table>';
90 ?>
91 </form>
92
93 <script>
94 function changepage(num)
95 {
96 document.all.trang.value=num;
97 search1.submit();
98 }
99 </script>
100
101 <?
102 }
103 else
104 {
105 ?>
106 <TABLE border="0" cellpadding="10" cellspacing="1" width="100%" id="table1">
107 <TR><TD class="DialogBox">
108 <FORM name="searchform" action="./" method="GET">
109 <table cellSpacing="0" cellPadding="2" width="100%" border="0" id="table2">
110 <tr>
111 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Từ khóa:</span></font></td>
112 <td class="fieldValue" width="55%">
113 <span style="font-size: 8.5pt"><font size="1" face="Tahoma">
114 <input name="keywords" size="255" style="width: 200; height:22"></font></span></td>
115 </tr>
116 <tr>
117 <td width="35%" align="right"> </td>
118 <td class="fieldValue" width="55%">
119 <span style="font-size: 8.5pt"><font face="Tahoma">
120 <input type="checkbox" value="1" name="search_in_description"> Chỉ tìm
121 trong phần mô tả sản phẩm</font></span></td>
122 </tr>
123 <tr>
124 <td width="35%" align="right"> </td>
125 <td class="fieldValue" width="55%">
126 <font face="Verdana" size="1">
127 <span style="font-size: 8.5pt">
128 <font face="Tahoma">
129 <input type=submit value="Tìm kiếm" class=buttonorange onmouseover="this.className='buttonblue'" onmouseout="this.className='buttonorange'"></font></span></font></td>
130 </tr>
131 <tr>
132 <td width="35%" align="right"> </td>
133 <td class="fieldValue" width="55%"> </td>
134 </tr>
135 <tr>
136 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Trong danh mục:</span></font></td>
137 <td class="fieldValue" width="55%">
138 <span style="font-size: 8.5pt"><font face="Tahoma">
139 <select name="categories_id" size="1" style="width: 200">
140 <option selected value="">[Toàn bộ danh mục]</option>
141 <?
142 $cats=GetListCategory(17);
143 foreach ($cats as $cat)
144 {
145 echo '<option value="'.$cat[0].'">'.$cat[1].'</option>';
146 }
147 ?>
148 </select></font></span></td>
149 </tr>
150 <tr>
151 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Giá (>=):</span></font></td>
152 <td class="fieldValue" width="55%"><span style="font-size: 8.5pt">
153 <font face="Tahoma"><input name="pfrom"></font></span></td>
154 </tr>
155 <tr>
156 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Giá (<=):</span></font></td>
157 <td class="fieldValue" width="55%"><span style="font-size: 8.5pt">
158 <font face="Tahoma"><input name="pto"></font></span></td>
159 </tr>
160 <tr>
161 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Ngày (>=):</span></font></td>
162 <td class="fieldValue" width="55%">
163 <span style="font-size: 8.5pt"><font face="Tahoma">
164 <input name="dfrom"> (tháng/ngày/năm)</font></span></td>
165 </tr>
166 <tr>
167 <td width="35%" align="right"><font face="Tahoma"><span style="font-size: 8.5pt">Ngày (<=):</span></font></td>
168 <td class="fieldValue" width="55%">
169 <span style="font-size: 8.5pt"><font face="Tahoma">
170 <input name="dto"> (tháng/ngày/năm)</font></span></td>
171 </tr>
172 </table>
173
174 <input type="hidden" name="act" value="search">
175
176 <input type="hidden" name="menu" value="search">
177
178 </FORM>
179 </TD></TR>
180 </TABLE>
181 <?
182 }
183 ?>